#include "memcache.h"


namespace Database
{

MemCache::MemCache(const uint64_t size, const uint64_t block_size)
	: size_(size), block_size_(block_size)
{
	/*
		FIXME: internal error exception if:
			size < block_size
			size == 0 || block_size == 0
			size or block_size != power of two
	*/

	errno = 0;
	cache_ = ::malloc(size);
	if(!cache_)
	{
		if(errno == ENOMEM)
		{ /* FIXME log error and exit */ }
	}
}

MemCache::~MemCache()
{
	if(cache_)
		free(cache_);
}

}	// namespace Database

